namespace BankSimulation
{
    public class CreditAccount : Account
    {
        public decimal CreditLimit { get; set; }

        public CreditAccount(string accountNumber, string owner, decimal initialBalance, decimal creditLimit)
            : base(accountNumber, owner, initialBalance)
        {
            CreditLimit = creditLimit;
        }

        public override void Withdraw(decimal amount)
        {
            if (amount > Balance + CreditLimit)
                throw new InvalidOperationException("超出信用额度");
            Balance -= amount;
        }
    }
}